package com.itheima.Demo;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class Demo暴力反射 {
    public static void main(String[] args) throws Exception {
        Class<Student> c1 = Student.class;
        Method play = c1.getDeclaredMethod("play", String.class);
        Constructor<Student> con = c1.getConstructor();
        Student stu = con.newInstance();
        play.setAccessible(true);
        play.invoke(stu,"idea");
    }
}
